"use strict";
cc._RF.push(module, '332ccpEuXFL4qciUl4yrOw2', 'Pregress');
// Script/Pregress.js

"use strict";

cc.Class({
  "extends": cc.Component,
  properties: {
    showTimes: 1,
    //隐藏时间
    jumpHeight: 100,
    //跳跃高度
    _isShow: false
  },
  //按钮点击回调
  onConfirBtn: function onConfirBtn(callback) {
    //console.log("发布按钮点击回调事件");
    this.node.getChildByName("startBtn").on('click', function (event) {
      isShow = 0; //console.log("点击到按钮");

      if (typeof callback === "function") {
        callback();
      } else {
        cc.log(callback);
      }

      this.finish(); //先销毁自己
    }, this);
  },
  // LIFE-CYCLE CALLBACKS:
  onLoad: function onLoad() {
    cc.log("showTips.onLoad");
    window.showtips = this; // 初始化计时器

    this.timer = 0;
    this.node.active = true;
    var slider = this.getComponent(cc.Slider);
    var progressbar = this.getComponent(cc.ProgressBar);

    if (slider == null || progressbar == null) {
      return;
    }

    progressbar.progress = slider.progress;
    var self = this;
    slider.node.on('slide', function (event) {
      progressbar.progress = slider.progress;
    }, this);
  },
  setJumpAction: function setJumpAction() {
    this.timer = 0; // 跳跃

    var jumpDown = cc.moveBy(this.showTimes, cc.v2(0, this.jumpHeight)).easing(cc.easeCubicActionIn());
    var callback = cc.callFunc(this.finish, this);
    return cc.repeat(cc.sequence(jumpDown, callback), 1);
  },
  finish: function finish() {
    isShow = 0;
    this._isShow = false;

    if (this.node) {
      this.node.active = this._isShow;
    }

    this.node.stopAllActions();
    this.node.destroy();
  },
  start: function start() {} // update (dt) {},

});

cc._RF.pop();